package org.example.Exception;

import org.example.core.Dto.common.Result;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalException {

    @ExceptionHandler(Exception.class)
    public ResponseEntity ExceptionHandler(Exception e)
    {
        e.printStackTrace();
        return ResponseEntity.status(HttpStatus.OK.value()).body(Result.error(e.getLocalizedMessage()));
    }
}
